// pages/order_detail/order_detail.js
import {GetOrderDetail} from "../../utils/request";

Page({

  /**
   * 页面的初始数据
   */
  data: {
      showLeft1: false,
      order_detail:{},
      fake_order: {
        'id': 1,
        'user_id': 1,
        'employee_id': 2,
        'order_num': '1231241231asdq2312313',
        'order_time': 1586500366,
        'appointment_time': 1586586766,
        'status': 0,
        'service_id': 1,
        'service_name': '家装',
        'sub_service_id': 1,
        'sub_service_name': '更换电灯',
        'is_negotiated': 0,
        'coupon_id': null,
        'service_cost': 2000,
        'product_cost': 1888,
        'reduced_cost': 0,
        'original_cost': 3888,
        'actual_price': 3888,
        log: [
          {
            'id': 1,
            'order_id': 1,
            'status': 0,
            'option_time': 1555555555,
          },
          {
            'id': 2,
            'order_id': 1,
            'status': 1,
            'option_time': 1555566666,
          },
        ],
        apply_cancel: {},
        apply_refund: {},
        address: {
          'id': 1,
          'province': 'asdasdas',
          'city': 'asdasdas',
          'county': 'adasdas',
          'town': 'asdasdsad',
          'detail': 'asdasdad',
          'user_id': 1
        },
        products: {
          id: 1,
          order_id: 1,
          product_id: 1,
          product: [
            {
              'id': 1,
              'name': '阿拉灯',
              'simple_desc': 'sdasd',
              'detail_desc': 'asdasdas',
              'prices': 1888,
              'img': 'https://i.loli.net/2017/08/21/599a521472424.jpg',
              'discount': 1000,
              'is_discount': 0,
              'sub_service_id': 1,
            }
          ]
        }
      },
  },
  toggleLeft1() {
    this.setData({
      showLeft1: !this.data.showLeft1
    });
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (query) {
      let order_id = JSON.parse(query.order_id)
      console.log(order_id)
      this.setData({
        order_detail: this.data.fake_order
      })
      GetOrderDetail(
          {order_id: order_id},
          res => {
            // this.setData({
            //   order_detail: res.data.data
            // })
            console.log(res)
          }
      )
  }
})